/* 
 * Copyright 2014 ShangDao.Ltd  All rights reserved.
 * SiChuan ShangDao.Ltd PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 * 
 * @ActBaEssence.java  2014-9-16 下午4:23:10 - Carson
 * @author Guzhu
 * @email:muyi126@163.com
 * @version 1.0
 */

package com.android.tiango.baba.act;

import java.util.ArrayList;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.TextView;

import com.android.scsd.tiango.R;
import com.android.tiango.baba.BaListActivity;
import com.android.tiango.baba.view.PullListView.PullListViewListener;

/**
 * 本吧精华
 * @author YW_pc
 * 
 */
public class ActBaEssence extends BaListActivity<String> implements PullListViewListener {
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		if (null != mTitleBar) {
			mTitleBar.setTitle("本吧精华(3)");
			mTitleBar.setImageBackGround(R.drawable.bg_title_blue);
			mTitleBar.setBackIcon(R.drawable.icon_back);
		}
		setBackOnClickListener();
		mListView.setPullListener(this);
		mListView.startOnRefresh();
	}

	@Override
	protected View getItemView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if (null == convertView) {
			holder = new ViewHolder();
			convertView = LayoutInflater.from(this).inflate(R.layout.item_actpost, null);
			holder.tv_acttitle = (TextView) convertView.findViewById(R.id.tv_acttitle);
			holder.tv_actinfo = (TextView) convertView.findViewById(R.id.tv_actinfo);
			convertView.setTag(holder);
		} else {
			holder = (ViewHolder) convertView.getTag();
		}
		convertView.setOnClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				showActivity(ActCardDetail.class, false);
			}
		});
		return convertView;
	}

	class ViewHolder {
		TextView tv_acttitle;
		TextView tv_actinfo;
	}

	private void loadData() {
		ArrayList<String> list = new ArrayList<String>();
		for (int i = 0; i < 5; i++) {
			list.add("");
		}
		mAdapter.putData(list);
		mListView.onRefreshFinish();
		mListView.onLoadFinish();
	}

	@Override
	public void onPullRefresh() {
		loadData();

	}

	@Override
	public void onPullLoadMore() {
		loadData();

	}

}
